#!/usr/bin/env perl
use 5.010;
use strict;

#读文件
if (! open FILE, "<", "all-u.txt") {
	die "error file not exits.";
}
#写文件
if (! open OUTPUT, ">", "txt_clean.txt") {
	die "error file not exits.";
}
while (<FILE>) {
	if ($_ =~ /([\t]*)([^ ]*) \| (.*)/) {
		my $level = length($1) + 2;
		my $id = $2;
		my $name = $3;
		
		#print "$id:\n";
		#修正id信息
		#print length($id);
		$id = sprintf("%-18s",$id);
		#print "$id:\n";
		$id =~ s/ /0/g;
		
		print "$id:$level:$name\n";
		print OUTPUT "$id:$level:$name\n";
	} 
}
=pod
for my $key (keys %hash) {
	print "$key, $hash{$key}\n";
}
=cut
